package com.lzy.canal.component.result.mysql;

import com.alibaba.otter.canal.protocol.CanalEntry;
import com.lzy.canal.enums.ConsumerRestTypeEnum;

import java.util.Map;

/**
 * dml
 *
 */
public class DefaultConsumerDmlRestData extends AbstractConsumerDmlRestData {
    private final Map<String, Object> resources;
    private final CanalEntry.EventType eventType;
    private final ConsumerRestTypeEnum type;

    public DefaultConsumerDmlRestData(String idKey, String isDeletedKey, Map<String, Object> resources, CanalEntry.EventType eventType) {
        super(idKey, isDeletedKey);
        this.resources = resources;
        this.eventType = eventType;
        this.type = getConsumerRestTypeEnum();
    }


    public DefaultConsumerDmlRestData(Map<String, Object> resources, CanalEntry.EventType eventType) {
        super("id", "is_deleted");
        this.eventType = eventType;
        this.resources = resources;
        this.type = getConsumerRestTypeEnum();
    }

    @Override
    public Map<String, Object> getResource() {
        return resources;
    }

    @Override
    public CanalEntry.EventType getEventType() {
        return eventType;
    }

    @Override
    public ConsumerRestTypeEnum getType() {
        return type;
    }



}
